<%@ page import="com.dailyblue.java.servlet.el.util.Student" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Arrays" %><%--
  Created by IntelliJ IDEA.
  User: dailyblue
  Date: 2023/4/2
  Time: 14:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>循环操作</title>
    <style>
        table {
            border: 1px gray solid;
            margin: auto;
            width: 60%;
        }
    </style>
</head>
<body>
<%--for循环--%>
<c:forEach var="i" begin="1" end="10" step="1">
    <p>${i}</p>
</c:forEach>
<%--for:实现九九乘法表--%>

<%--foreach循环--%>
<%
    Student s1 = new Student(1, "张三1", '男');
    Student s2 = new Student(2, "张三2", '男');
    Student s3 = new Student(3, "张三3", '女');
    Student s4 = new Student(4, "张三4", '男');
    Student s5 = new Student(5, "张三5", '男');
    List<Student> list = Arrays.asList(s1, s2, s3, s4, s5);
    session.setAttribute("LIST", list);
    /*for(Student stu:list){

    }*/
%>
<c:forEach var="stu" items="${LIST}" varStatus="j">
    ${j.count}...${stu}<br/>
</c:forEach>
<%--将这个用户信息以表格形式展现--%>
<table>
    <tr>
        <th>序号</th>
        <th>姓名</th>
        <th>性别</th>
    </tr>
    <c:forEach var="stu" items="${LIST}" varStatus="j">
        <tr>
            <td>${j.count}</td>
            <td>${stu.name}</td>
            <td>${stu.gender}</td>
        </tr>
    </c:forEach>
</table>
</body>
</html>
